﻿using B.S.Warehouse.ErrorCord;
using B.S.Warehouse.Write.Api.Application.Command.StockInApplicationCommand;
using B.S.Warehouse.Write.Api.Application.Command.StockInDetailCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Warehouse.Write.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class RKCKController : ControllerBase
    {
        private readonly IMediator mediator;
        public RKCKController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 入库管理添加
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<ApiResult<object>> StockInApplication(AddStockInApplicationCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 入库管理删除
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<ApiResult<int>> DelStockInApplication([FromQuery]DelStockInApplicationCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 入库管理修改
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<ApiResult<int>> UpdateStockInApplication(UpdateStockInApplicationCommand request)
        {
            return await mediator.Send(request);
        }
    }
}
